package Song.Han.Demo01;

import java.io.*;

/*
    练习：转换文件编码
        将GBK编码的文本文件，转换为UTF-8编码的文本文件
*/
public class Demo03Test {
    public static void main(String[] args) throws IOException{

        InputStreamReader isr = new InputStreamReader(new FileInputStream("E:\\IDeaProject\\Day15\\src\\Song\\Han\\Demo01\\gbk.txt"),"gbk");

        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("E:\\IDeaProject\\Day15\\src\\Song\\Han\\Demo01\\转换后的utf-8"),"utf-8");

        int len = 0;
        while ((len = isr.read())!=-1){
            osw.write(len);
        }

        osw.close();
        isr.close();
    }
}
